import React, { Component } from 'react';
import {
    View,
    Text,
    ListView,
} from 'react-native';

import { Tradelist_style as styles } from '../../../../../styles';
import Trade_in from './tradein'

export default class Trade_list extends Component {
    // 初始化模拟数据
    constructor(props) {
        super(props);
        const ds = new ListView.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2 });
        this.state = {
            dataSource: ds.cloneWithRows(['教育培训', '游戏开发', '政府医疗', '电子商务', '社交通讯', '新闻资讯', '金融财务', '娱乐应用', '企业管理']),
        };
    }

    render() {
        return (
            <View style={[styles.sal_all, { flex: 1 }]}>
                <Text style={styles.sal_toptext}>选择行业</Text>
                <ListView
                    dataSource={this.state.dataSource}
                    renderRow={this.renderRow.bind(this)}
                    contentContainerStyle={styles.sal_list}
                    initialListSize={1000} />
            </View>
        );
    }

    renderRow(rowData) {
        return (
            <Trade_in
                addfields={this.props.addfields.bind(this)}
                delefields={this.props.delefields.bind(this)}
                rowData={rowData} />
        )
    }

}